<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"
         import="java.net.*" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<c:set var="ctxPath" value="${pageContext.request.contextPath}" />

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <title>用户登陆</title>
    <link rel="stylesheet" href="layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="layuiadmin/style/admin.css" media="all">
    <link rel="stylesheet" href="layuiadmin/style/login.css" media="all">
    <%
        String msg = request.getParameter("msg");
        if( msg!=null ){
            byte[] buff = msg.getBytes("ISO-8859-1");
            msg = new String(buff,"UTF-8");
            //msg = 用户登录失败。
        }else{
            msg = "";
        }
    %>

</head>
<body onKeyUp="return keyFunc(event);" onload="init();">

<div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login" style="display: none;">

    <div class="layadmin-user-login-main">
        <div class="layadmin-user-login-box layadmin-user-login-header">
            <h2>OA管理系统</h2>
            <p>小蓝与小姗</p>
        </div>
        <form id="userForm" action="${ctxPath}/login" accept-charset="UTF-8" method="post">
            <div class="layadmin-user-login-box layadmin-user-login-body layui-form">
                <div class="layui-form-item">
                    <label class="layadmin-user-login-icon layui-icon layui-icon-username" for="loginName"></label>
                    <input type="text" name="loginName" id="loginName" placeholder="用户名" class="layui-input">
                </div>
                <div class="layui-form-item">
                    <label class="layadmin-user-login-icon layui-icon layui-icon-password" for="pwd"></label>
                    <input type="password" name="pwd" id="pwd" placeholder="密码" class="layui-input">
                </div>
                <!-- 可加入验证码 -->
                <div class="layui-form-item">
                    <div class="layui-row">
                        <div class="layui-col-xs7">
                            <label class="layadmin-user-login-icon layui-icon layui-icon-vercode" for="LAY-user-login-vercode"></label>
                            <input type="text" name="vercode" id="LAY-user-login-vercode" lay-verify="required" placeholder="图形验证码" class="layui-input">
                        </div>
                        <div class="layui-col-xs5">
                            <div style="margin-left: 10px;">
                                <img src="https://www.oschina.net/action/user/captcha" class="layadmin-user-login-codeimg" id="LAY-user-get-vercode">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item" style="margin-bottom: 20px;">
                    <input type="checkbox" name="remember" lay-skin="primary" title="记住密码">
                    <a href="forget.html" class="layadmin-user-jump-change layadmin-link" style="margin-top: 7px;">忘记密码？</a>
                </div>
                <%--加入验证信息--%>
                <div class="layui-form-item">
                    <button class="layui-btn layui-btn-fluid" onClick="gotoSub();">登 入</button>
                </div>
            </div>
        </form>
    </div>

    <div class="layui-trans layadmin-user-login-footer">
        <p>© 2020 <a href="https://www.cnblogs.com/Lantxy" target="_blank">小蓝与小姗</a>  版权所有</p>
    </div>

</div>
<script src="${ctxPath}/layuiadmin/layui/layui.js"></script>
<script>
    layui.config({
        base: '${ctxPath}/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use('index', function(){
        var layer = layui.layer
    });
</script>
<script>
    function gotoSub(){
        var form = document.getElementById( 'userForm' );
        form.submit();
    }

    function keyFunc( e ){
        var keyNum = window.event ? e.keyCode : e.which;
        if( keyNum==13 ){
            gotoSub();
            return true;
        }
        return false;
    }

    function init(){
        //document.body.clientWidth
        //var height = document.body.clientHeight;
        //var box = document.getElementById( 'up_box' );
        //box.style.marginTop = (height - 230)/2 +'px';

        var msg = '<%=msg%>';
        if( msg ){
            layer.msg( msg ,
                {icon:2,time:2000,offset:'60%'});
        }
    }

</script>
</body>

</html>



